#include <unordered_map>
class Solution
{
    bool hash[1010] = {0};

public:
    vector<int> intersection(vector<int> &nums1, vector<int> &nums2)
    {
        vector<int> ret;
        for (auto e : nums1)
        {
            hash[e] = true;
        }
        for (auto e : nums2)
        {
            if (hash[e])
            {
                ret.push_back(e);
                hash[e] = false;
            }
        }
        return ret;
    }
};